using UnityEngine;
using System.Collections;

public class PlayerRunState : State<PlayerControl>
{
    #region Singleton

    private static PlayerRunState instance = new PlayerRunState();
    public static PlayerRunState Instance { get { return instance; } }
    private PlayerRunState() { }

    #endregion
    
    #region State

    public override void OnEnter(PlayerControl behaviour)
    {
        behaviour.playerPrefab.animation.CrossFade(AnimationConstants.PLAYER_JUMP);
    }

    public override void OnUpdate(PlayerControl behaviour)
    {
        behaviour.playerPrefab.animation.CrossFade(AnimationConstants.PLAYER_JUMP_LOOP);
        behaviour.Move(behaviour.directionToMove, behaviour.runSpeed);

/*        float yPos = behaviour.initialPosition.y + behaviour.animation[AnimationConstants.PLAYER_JUMP_LOOP].time * 1f;

        behaviour.transform.position = new Vector3(behaviour.transform.position.x,
                                                   yPos,
                                                   behaviour.transform.position.z);
 */ 
    }

    public override void OnExit(PlayerControl behaviour)
    {
    }

    public override void OnAction(string name, PlayerControl behaviour, object value)
    {
    }

    #endregion
}
